# 变量定义
project_name='okms-api'
project_zip_name=${project_name}.tar.gz

# 清理缓存
cd $WORKSPACE
[ -f $project_zip_name ] && rm -f $project_zip_name
tar czf /tmp/$project_zip_name --exclude='.git' --exclude='.idea' ./*
mv /tmp/$project_zip_name ./









# ------------------------------------------------------
Source files:       okms-api.tar.gz
Remove prefix:
Remote directory:   /home/py36admin/deploy
Exec command:

# 导入环境变量，不然等下提示找不到pip
source ~/.bash_profile
# 执行脚本
cd /home/py36admin/deploy
project_name='okms-api'
deploy_dir='webapps'
# 创建新版本的目录
[ ! -d $project_name ] && mkdir $project_name
cd $project_name
[ ! -d $deploy_dir ] && mkdir $deploy_dir
# 清除之前的旧版本
rm -rf $deploy_dir/*
# 释放程序文件
tar -zxf ../okms-api.tar.gz -C $deploy_dir
# 安装依赖软件
cd $deploy_dir
pip install -r requirements.txt
# 手动生成静态文件，gunicorn或者nginx需要用到
python manage.py collectstatic --no-input
# 启动程序
# nohup python manage.py runserver 0.0.0.0:8000 &
# netstat -nap | grep python


